import { lazy } from "react"
import type { RouteObject } from "react-router-dom"
import { Navigate } from "react-router-dom"


const Discover = lazy(() => import("@/views/Discover"))
const Mine = lazy(() => import("@/views/Mine"))
const Download = lazy(() => import("@/views/Download"))
const Follow = lazy(() => import("@/views/Follow"))

const Album = lazy(() => import("@/views/Discover/c-views/Album"))
const Artist = lazy(() => import("@/views/Discover/c-views/Artist"))
const BraodCasting = lazy(() => import("@/views/Discover/c-views/BraodCasting"))
const Ranking = lazy(() => import("@/views/Discover/c-views/Ranking"))
const Recommend = lazy(() => import("@/views/Discover/c-views/Recommend"))


const routes: RouteObject[] = [
    {
        path: "/",
        element: <Navigate to="/discover" />
    },
    {
        path: "/discover",
        element: <Discover />,
        children: [
            {
                path: "/discover",
                element: <Navigate to="/discover/recommend" />,
            },
            {
                path: "/discover/album",
                element: <Album />,
            },
            {
                path: "/discover/artist",
                element: <Artist />,
            },
            {
                path: "/discover/broadcasting",
                element: <BraodCasting />,
            },
            {
                path: "/discover/ranking",
                element: <Ranking />,
            },
            {
                path: "/discover/recommend",
                element: <Recommend />,
            },
        ]
    },
    {
        path: "/mine",
        element: <Mine />
    },
    {
        path: "/download",
        element: <Download />
    },
    {
        path: "/follow",
        element: <Follow />
    }
]

export default routes